{include file="header.html"}
<script type="text/javascript">
$(function(){
    $('#add_time_from').datepicker({dateFormat: 'yy-mm-dd'});
    $('#add_time_to').datepicker({dateFormat: 'yy-mm-dd'});
    $('#return_time_from').datepicker({dateFormat: 'yy-mm-dd'});
    $('#return_time_to').datepicker({dateFormat: 'yy-mm-dd'});
    $('.output_btn').bind('click',function(){
        if($('#add_time_from').val() == '' || $('#add_time_to').val() == '')
        {
            alert("请选择添加时间!")
            return false;
        }
		var $export_type = $(this).attr("name");
        var $hidden_input=$('<input type="hidden" id="out_hid_input" name="isexport" value="1" />');
		var $export_type_input=$('<input type="hidden" id="export_type" name="export_type" value="'+$export_type+'" />');
		$("input[name='act']").val("export");
		$('#output_form').prepend($export_type_input);
        $('#output_form').prepend($hidden_input).submit();
		$("input[name='act']").val("index");
        $('#out_hid_input').remove();
		$('#export_type').remove();
    });
    $('.output_btn_3').bind('click',function(){
        if($('#return_time_from').val() == '' || $('#return_time_to').val() == '')
        {
            alert("请选择回访时间!")
            return false;
        }
        window.location.href="index.php?app=customer&act=export&export_type=3&return_time_from="+$('#return_time_from').val()+"&return_time_to="+$('#return_time_to').val();
    });
});
</script>
<div id="rightTop">
  <p>客户关系管理</p>
  <ul class="subnav">
    <li><span>管理</span></li>
    <li><a class="btn1" href="index.php?app=customer&amp;act=add">新增客户</a></li>
    <li><a href="javascript:;" class="btn1 output_btn" name="1" >导出清单</a></li>
    <li><a href="javascript:;" class="btn1 output_btn_3" name="3" >导出资料</a></li>
  </ul>
</div>
<div class="mrightTop">
  <div class="fontl">
    <form method="get" id="output_form">
      <div class="left">
        <input type="hidden" name="app" value="customer" />
        <input type="hidden" name="act" value="index" />
          <select class="querySelect" name="field">{html_options options=$search_options selected=$smarty.get.field}
          </select>:<input class="queryInput" type="text" name="search_name" value="{$query.search_name|escape}" />
        资料来源:
        <select class="querySelect" name="source">
          <option value="">全部</option>
          
                    {html_options options=$cfg_customer.source selected=$query.source}
                
        </select>
          添加时间从:<input class="queryInput pick_date" type="text" value="{$query.add_time_from}" id="add_time_from" name="add_time_from"  />
          至:<input class="queryInput pick_date" type="text" value="{$query.add_time_to}" id="add_time_to" name="add_time_to" />
         回访方式:
       <select class="querySelect" name="return_way">
          <option value="">全部</option>
          
                    {html_options options=$cfg_customer.return_way selected=$query.return_way}
                
        </select>
          回访时间从:<input class="queryInput pick_date" type="text" value="{$query.return_time_from}" id="return_time_from" name="return_time_from"  />
          至:<input class="queryInput pick_date" type="text" value="{$query.return_time_to}" id="return_time_to" name="return_time_to" />
        <input type="submit" class="formbtn" value="{$lang.query}" />
      </div>
      <!--{if $filtered}-->
      <a class="left formbtn1" href="index.php?app=customer">{$lang.cancel_query}</a>
      <!--{/if}-->
    </form>
  </div>
  <div class="fontr"> {if $customer}{include file=page.top.html}{/if} </div>
</div>
<div class="tdare">
  <table width="100%" cellspacing="0" class="dataTable">
    <!--{if $customers}-->
    <tr class="tatr1">
    <td width="20" class="firstCell"><input type="checkbox" class="checkall" /></td>
      <td width="70"><span ectype="order_by" fieldname="customer_name">客户姓名</span></td>
      <td width="80">会员名称</td>
      <!--<td width="120">公司名称</td>-->
      <td>手机</td>
      <td width="60">QQ</td>
      <td width="60">E-MALL</td>
      <td width="80">城市</td>
      <!--<td>地址</td>-->
      <td>客户等级</td>
      <td>资料来源</td>
      <td><span ectype="order_by" fieldname="c.add_time">添加时间</span></td>
      <td><span ectype="order_by" fieldname="reason">回访原因</span></td>
      <td>回访方式</td>
      <td><span ectype="order_by" fieldname="return_time">最后回访时间</span></td>
      <td><span ectype="order_by" fieldname="re_operator">操作人</span></td>
      <td width="8%">{$lang.handler}</td>
    </tr>
    <!--{/if}-->
    <!--{foreach from=$customers item=customer}-->
    <tr class="tatr2">
     <td class="firstCell"><input type="checkbox" class="checkitem" value="{$customer.customer_id}"/></td>
      <td>{$customer.customer_name|escape}</td>
      <td><!--{if $customer.user_name}--><a href="index.php?app=customer&amp;act=view_record&amp;id={$customer.customer_id}">{$customer.user_name|escape}</a><!--{/if}--></td>
      <!--<td>{$customer.company|escape}</td>-->
      <td>{$customer.phone_mob}</td>
      <td>{$customer.im_qq}</td>
      <td>{$customer.email|escape}</td>
      <td>{$customer.city|escape}</td>
      <!--<td>{$customer.address|escape}</td>-->
      <td>{$customer.customer_ugrade|escape}</td>
      <td>{$customer.source|escape}</td>
      <td>{$customer.add_time}</td>
      <td>{$customer.reason|escape}</td>
      <td>{$customer.return_way|escape}</td>
      <td>{$customer.return_time}</td>
      <td>{$customer.re_operator|escape}</td>
      <td><a href="index.php?app=customer&amp;act=edit&amp;id={$customer.customer_id}">{$lang.edit}</a> | <a href="javascript:drop_confirm('{$lang.drop_confirm}', 'index.php?app=customer&amp;act=drop&amp;id={$customer.customer_id}');">{$lang.drop}</a> | <a href="index.php?app=customer&amp;act=export&amp;export_type=2&amp;id={$customer.customer_id}">导出</a><br/><a href="index.php?app=customer&amp;act=add_record&amp;id={$customer.customer_id}">添加记录</a> | <a href="index.php?app=customer&amp;act=view_record&amp;id={$customer.customer_id}">查看记录</a></td>
    </tr>
    <!--{foreachelse}-->
    <tr class="no_data">
      <td colspan="10">{$lang.no_data}</td>
    </tr>
    <!--{/foreach}-->
  </table>
  <!--{if $customers}-->
    <div id="dataFuncs">
        <div class="pageLinks">
            {include file=page.bottom.html}
        </div>
        <div id="batchAction" class="left paddingT15">
            &nbsp;&nbsp;
            <input class="formbtn batchButton" type="button" value="{$lang.drop}" name="id" uri="index.php?app=customer&act=drop" presubmit="confirm('{$lang.drop_confirm}');" />
        </div>
    </div>
    <div class="clear"></div>
  </div>
  <!--{/if}-->
</div>
{include file="footer.html"} 